<template>
  <div>
    <el-table :data="list" style="width: 100%" class="mt20" height="500">
      <el-table-column type="index" label="序号" width="50" align="center">
      </el-table-column>
      <el-table-column align="center" prop="sex" label="设备类型">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.device_type" :value="scope.row.type" />
        </template>
      </el-table-column>
      <el-table-column align="center" prop="name" label="设备名称">
      </el-table-column>
      <el-table-column align="center" prop="code" label="设备编码">
      </el-table-column>
<!--      <el-table-column align="center" prop="cardNum" label="物联网卡号">-->
<!--      </el-table-column>-->
      <el-table-column align="center" prop="installLocation" label="位置描述">
      </el-table-column>
      <el-table-column align="center" prop="totalPower" label="累计电耗(度)">
        <template slot-scope="scope">
          {{ scope.row.totalPower/100 }}
        </template>
      </el-table-column>
      <el-table-column align="center" prop="ratio" label="设备能耗份额占比(%)">
      </el-table-column>
      <el-table-column align="center" prop="statusName" label="设备状态">
        <template slot-scope="scope">
          {{ scope.row.status == 2 ? "故障" : "启用" }}
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import { deviceList } from "@/api/park/roommsg.js";

export default {
  dicts: ["device_type"],
  props: {
    id: {
      type: [Number, String],
      default: "",
    },
  },
  data() {
    return {
      list: [],
    };
  },
  methods: {
    getList() {
      let that = this;
      const data = {
        roomId: this.id,
      };
      deviceList(data)
        .then((res) => {
          if (res.code === 700) {
            this.$message.warning(res.msg);
            return false;
          }
          that.list = res?.rows ?? [];
        })
        .catch((err) => {
          // this.$message.error("系统错误,请联系管理员!");
        });
    },
  },
};
</script>
